/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.uccart_project.model;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;


@Entity
@Table(name = "requisito")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Requisito.findAll", query = "SELECT r FROM Requisito r"),
    @NamedQuery(name = "Requisito.findByReqCod", query = "SELECT r FROM Requisito r WHERE r.reqCod = :reqCod"),
    @NamedQuery(name = "Requisito.findByReqTipo", query = "SELECT r FROM Requisito r WHERE r.reqTipo = :reqTipo")})
public class Requisito implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "req_cod")
    private Integer reqCod;
    @Column(name = "req_tipo")
    private Boolean reqTipo;
    @JoinColumn(name = "req_materia", referencedColumnName = "materia_id")
    @ManyToOne
    private Materia reqMateria;
    @JoinColumn(name = "req_requisito", referencedColumnName = "materia_id")
    @ManyToOne
    private Materia reqRequisito;
    @JoinColumn(name = "req_carrera", referencedColumnName = "carr_cod")
    @ManyToOne
    private Carrera reqCarrera;

    public Requisito() {
    }

    public Requisito(Integer reqCod) {
        this.reqCod = reqCod;
    }

    public Integer getReqCod() {
        return reqCod;
    }

    public void setReqCod(Integer reqCod) {
        this.reqCod = reqCod;
    }

    public Boolean getReqTipo() {
        return reqTipo;
    }

    public void setReqTipo(Boolean reqTipo) {
        this.reqTipo = reqTipo;
    }

    public Materia getReqMateria() {
        return reqMateria;
    }

    public void setReqMateria(Materia reqMateria) {
        this.reqMateria = reqMateria;
    }

    public Materia getReqRequisito() {
        return reqRequisito;
    }

    public void setReqRequisito(Materia reqRequisito) {
        this.reqRequisito = reqRequisito;
    }

    public Carrera getReqCarrera() {
        return reqCarrera;
    }

    public void setReqCarrera(Carrera reqCarrera) {
        this.reqCarrera = reqCarrera;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (reqCod != null ? reqCod.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Requisito)) {
            return false;
        }
        Requisito other = (Requisito) object;
        if ((this.reqCod == null && other.reqCod != null) || (this.reqCod != null && !this.reqCod.equals(other.reqCod))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.uccart_project.model.Requisito[ reqCod=" + reqCod + " ]";
    }
    
}
